$(function(){
    //初始化页面列表
    $("#state_datagrid").datagrid({
        fit:true,
        url:"/accident/allList",
        fitColumns:true,
        striped:true,
        pagination:true,
        singleSelect:true,
        checkOnSelect:true,
        rownumbers:true,
        toolbar:"#tb",
        columns:[[
            {field:'id',title:'编号', hidden:true},
            {field:'checkbox',checkbox:true,tilte:'选中',width:100},
            {field:'state',title:'当前状态',align:'center',width:100,formatter:function(value){
                if(value==1){
                    return "<p style='color: orange'>待验证</p>"
                }else if(value==2){
                    return "<p style='color: hotpink'>验证完,待填理赔单</p>"
                }else if(value==3){
                    return "<p style='color: mediumpurple'>理赔单完,待提审</p>"
                }else if(value==4){
                    return "<p style='color: #00bbee'>待审核</p>"
                }else if(value==5){
                    return "<p style='color: green'>审核完成</p>"
                }else if(value==6){
                    return "<p style='color: darkgreen'>支付完成</p>"
                }else if(value==7){
                    return "<p style='color: red'>支付失败</p>"
                }else if(value==8){
                    return "<p style='color: red'>审核驳回</p>"
                }else{
                    return "<p style='color: darkblue'>未知状态</p>"
                }
            }},
            {field:'reporterName',title:'报案人姓名',align:'center',width:100,formatter:function(value,rows,index){
                if(rows.client!=null){
                    return rows.client.clientname;
                }else{
                    return "";
                }
            }},
            {field:'gender',title:'性别',align:'center',width:60,formatter:function(value,rows,index){
                if(rows.client.gender==1){
                    return "男";
                }else{
                    return "女";
                }
            }},
            {field:'tel',title:'联系方式',align:'center',width:100,formatter:function(value,rows,index){
                if(rows.client!=null){
                    return rows.client.tel;
                }else{
                    return "";
                }
            }},
            {field:'email',title:'邮箱',align:'center',width:100,formatter:function(value,rows,index){
                if(rows.client!=null) {
                    return rows.client.email;
                }else{
                    return "";
                }
            }},
            {field:'occurenceTime',title:'事故发生时间',align:'center',width:100},
            {field:'caseDescript',title:'事故描述',align:'center',width:100},
            {field:'occurencePlace',title:'事故发生地点',align:'center',width:100},
            {field:'responsibility',title:'责任',align:'center',width:100},
            {field:'inputStaff',title:'录单人',align:'center',width:80},
            {field:'validateStaff',title:'验证人',align:'center',width:80},
            {field:'note',title:'备注',align:'center',width:100}
        ]]
    })
            /*{field:'insuranceNo',title:'保险单号',align:'center',width:100},*/
    //初始化页面列表--end
})



//页面列表查询
function search1() {
    var keyword = $("#keyword").textbox("getValue");
    var beginTime = $("#beginTime").datebox("getValue");
    var endTime = $("#endTime").datebox("getValue");
    var state = $("#state").combobox("getValue");
    $("#state_datagrid").datagrid("load",{
        keyword:keyword,
        beginTime:beginTime,
        endTime:endTime,
        state:state
    })
}
//页面列表查询--end

//刷新列表页面
function reload1(){
    $("#state_datagrid").datagrid("reload");
}
//刷新列表页面--end
